<?php
namespace app\admin\model;
use think\Db;
use think\Model;

class CashModel extends Model
{
	 public function __construct()
    {
        parent::__construct();

    }
    public function getDriverWithdrawList($page,$limit,$map=array(),$field='a.*')
    {
    	return Db::name('driver_wallet_record a')->join('__DRIVER_BANK__ b','a.driver_id = b.driver_id','LEFT')
            ->join(['xm_driver_base'=>'c'],'a.driver_id = c.driver_id','LEFT')->join('__BANK__ d','b.bank_id = d.id','LEFT')
            ->join('__ORDER_COMMON__ e','e.common_id = a.common_id','LEFT')
            ->join('__ADMIN__ f','f.admin_id = a.auditor_id','LEFT')
            ->join('__ADMIN__ g','g.admin_id = a.payer_id','LEFT')
            ->page($page,$limit)->where($map)->order('a.record_id desc,a.approve desc')
            ->field($field)->select();
    }

    public function getDriverWithdrawInfo($map=array(),$field='a.*')
    {
        return Db::name('driver_wallet_record a')->join('__DRIVER_BANK__ b','a.driver_id = b.driver_id','LEFT')
            ->join(['xm_driver_base'=>'c'],'a.driver_id = c.driver_id','LEFT')
            ->join('__BANK__ d','b.bank_id = d.id','LEFT')
            ->where($map)->order('a.record_id desc,a.approve desc')
            ->field($field)->find();
    }
}
